<template>
	<view>
		<view
			style="background: url(https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230411/e63bcf73858e37c567847ca55821ddfa.png) no-repeat;background-size: 100%;width: 100%;height: 414rpx;">
		</view>
		<view style="width: 94%;position: absolute;top:30rpx;left: 3%;padding-bottom: 160rpx;">
			<view style="box-sizing: border-box;padding: 30rpx;background-color: #FFFFFF;border-radius: 12rpx;">
				<view style="overflow: hidden;">
					<view @click="yonghu_xx(xiang.user_id,xiang.type,xiang.firm_id,xiang.user.special_manage,xiang.user.nickname)" style="width: 18%;float: left;overflow: hidden;position: relative;">
						<image :src="xiang.user.avatar"
							style="width: 92rpx;height: 92rpx;border-radius: 50%;display: block;"
							mode=""></image>
						<image v-if="xiang.user.is_vip==1 && xiang.type==2"
							src="https://frozen-info.oss-cn-shanghai.aliyuncs.com/uploads/miniapp/ren.png" style="width: 30rpx;height: 30rpx;position: absolute;right: 10rpx;bottom: 0rpx;z-index: 4;"
							mode=""></image>
							<!-- 个人 -->
						<image v-if="xiang.user.is_vip==2 && xiang.type==2"
							src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20220616/ce4d9a4e5c9d814d939dc3324abc44d6.png" style="width: 30rpx;height: 30rpx;position: absolute;right: 10rpx;bottom: 0rpx;z-index: 4;"
							mode=""></image>
							<!-- 企业 -->
						<image v-if="xiang.type==1"
							src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20220616/daf7dad493b169a57961fac90302d9be.png" style="width: 30rpx;height: 30rpx;position: absolute;right: 10rpx;bottom: 0rpx;z-index: 4;"
							mode=""></image>
					</view>
					<view style="width: 82%;float: left;padding: 6rpx 0;">
						<view style="height: 44rpx;line-height: 44rpx;position: relative;box-sizing: border-box;padding-right: 200rpx;">
							<text v-if="xiang.user.is_vip==2" style="color: #2B85E4;font-size: 30rpx;display: block;max-width: 300rpx;float: left;"
								class="yihang">
								<text v-if="xiang.type==2">
									<text v-if="xiang.user.remark_name!=''">{{xiang.user.remark_name || ''}}</text>
									<text v-if="xiang.user.remark_name!=''" style="margin-left: 10rpx;font-size: 26rpx;">{{xiang.user.name || ''}}</text>
									<text v-if="xiang.user.remark_name==''">{{xiang.user.name || ''}}</text>
								</text>
								<text v-if="xiang.type==1">{{xiang.user.nickname}}</text>
							</text>
							<text v-if="xiang.user.is_vip==1" style="color: #F29100;font-size: 30rpx;display: block;max-width: 300rpx;float: left;font-weight: 600;"
								class="yihang">
								<text v-if="xiang.type==2">

									<text v-if="xiang.user.remark_name!=''">{{xiang.user.remark_name || ''}}</text>
									<text v-if="xiang.user.remark_name!=''" style="margin-left: 10rpx;font-size: 26rpx;">{{xiang.user.name || ''}}</text>
									<text v-if="xiang.user.remark_name==''">{{xiang.user.name || ''}}</text>
								</text>
								<text v-if="xiang.type==1">{{xiang.user.nickname}}</text>
							</text>
							<text @click="sixin"
								style="display: inline-block;width: 130rpx;height: 52rpx;line-height: 52rpx;text-align: center;border: 1px solid #1fb0ac;background-color: #fff;color: #1fb0ac;font-size: 22rpx;border-radius: 26rpx;position: absolute;top: 50%;right: 0;transform: translateY(-50%);">
								私信
							</text>
						</view>
						<!-- <view style="height: 44rpx;line-height:44rpx;color: #999999;font-size: 24rpx;" class="yihang">
							{{xiang.user.company || ''}}
						</view> -->
						<!-- 个人 -->
						<view v-if="xiang.type==2" style="font-size: 24rpx;margin-top: 10rpx;line-height: 30rpx;">
							<text v-if="xiang.user.company!=''">{{xiang.user.company || ''}}</text>
							<text v-if="xiang.user.position!=''" style="margin-left: 20rpx;">{{xiang.user.position || ''}}</text>
						</view>
						<!-- 企业 -->
						<view v-if="xiang.type==1" style="font-size: 24rpx;margin-top: 10rpx;line-height: 30rpx;">
							<text v-if="xiang.user.user_nickname!=''">{{xiang.user.user_nickname || ''}}</text>
							<text v-if="xiang.user.user_position!=''" style="margin-left: 20rpx;">{{xiang.user.user_position || ''}}</text>
						</view>
						<view style="overflow: hidden;margin-top: 10rpx;">
							<text class="xiao" style="color: red;" v-if="xiang.is_top==1">置顶</text>
							<text v-if="xiang.tips_manage.length>0" v-for="(a,b) in xiang.tips_manage" :key='b' class="xiao">{{a.name}}</text>
						</view>
					</view>
					<!-- <view style="width: 22%;float: left;">
						<text @click="sixin"
							style="display: inline-block;width: 130rpx;height: 52rpx;line-height: 52rpx;text-align: center;background-color: #1fb0ac;color: #FFFFFF;font-size: 22rpx;border-radius: 26rpx;margin-top: 20rpx;">
							私信TA
						</text>
					</view> -->
				</view>
				<!-- <view style="line-height: 60rpx;color: #000000;font-size: 30rpx;margin-top: 10rpx;font-weight: 600;">
					新鲜冻虾
				</view> -->


				<view style="color: #666666;font-size: 28rpx;line-height: 40rpx;margin-top: 10rpx;">
					<text>{{xiang.main_content || ''}}</text>
				</view>
				<view style="overflow: hidden;margin-top: 20rpx;" class="tu" v-if="xiang.main_images">
					<view v-for="(a,b) in xiang.main_images" :key='b'
						style="width: 190rpx;height: 190rpx;float: left;border-radius: 16rpx;overflow: hidden;">
						<image @click="fangda(b)" :src="a" style="width: 100%;height: 100%;left: 0;" mode="aspectFill"></image>
					</view>

				</view>
				<view style="overflow: hidden;margin: 10rpx 0 0;" class="flex justify-between">
					<view class="flex items-center">
						<u-icon name="map" size="18" color="#999" class=""></u-icon>
						<text style="margin-left: 10rpx;display: inline-block;color: #999999;font-size: 26rpx;line-height: 60rpx;" class="yihang">{{xiang.city || ''}}</text>
					</view>
					<text
						style="color: #999999;font-size: 26rpx;display: block;line-height: 60rpx;">{{xiang.create_time}} </text>
				</view>
				<view v-if="xiang.show_mobile==1" style="overflow: hidden;width: 100%;margin: 10rpx auto;">
					<view style="width: 55%;float: left;">
						<view style="line-height: 60rpx;padding-left: 40rpx;position: relative;">
							<image src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20220329/%E5%9B%BE%E5%B1%82%20540%402x.png" style="width: 30rpx;height: 30rpx;position: absolute;top: 15rpx;left: 0;" mode=""></image>
							<text style="color: #333333;font-size: 26rpx;">
								<text>{{hideMobile(xiang.mobile) || '待完善'}}</text>
							</text>
						</view>
					</view>
					<view @click="phone" style="width: 20%;float: right;color: #0078FF;font-size: 22rpx;line-height: 60rpx;text-align: right;">
						拨打电话
					</view>
					<view @click="cope_phone" style="width: 20%;float: right;color: #0078FF;font-size: 22rpx;line-height: 60rpx;text-align: right;">
						复制电话
					</view>
				</view>
				<view v-if="xiang.show_mobile==0" style="width: 100%;margin: 10rpx auto;line-height: 60rpx;color: #0078FF;font-size: 28rpx;">
					用户不便于展示联系方式
				</view>
				<view v-if="false" style="max-width: 200rpx;float: left;color: #666666;font-size: 26rpx;line-height: 40rpx;padding: 10rpx 0;" class="yihang">{{item.city || ''}}</view>
				<view style="line-height: 80rpx;display: flex;">
					<view @click="dian" class="flex items-center justify-center"
						style="flex: 1;font-size: 24rpx;box-sizing: border-box;position: relative;" :class="xiang.like==1?'active':'a'">
						<image
							v-if="+xiang.like === 2"
							src="@/static/index/icon_like.png"
							style="width: 48rpx;height: 48rpx;margin-right: 6rpx;"
							mode=""></image>
							<image
							v-else-if="+xiang.like === 1"
							src="@/static/index/icon_like1.png"
							style="width: 48rpx;height: 48rpx;margin-right: 6rpx;"
							mode=""></image>
						<iconLike :likeNum="xiang.like" v-if="false"></iconLike>
						({{xiang.like_num || 0}})
					</view>
					<view
					 class="flex items-center justify-center"
						style="flex: 1;color: #999999;font-size: 24rpx;box-sizing: border-box;position: relative;">
						<image
							src="@/static/index/icon_comment.png"
							style="width: 48rpx;height: 48rpx"
							mode=""></image>
						({{xiang.comment_num || 0}})
					</view>
					<view @click="shou" class="flex items-center justify-center"
						style="flex: 1;font-size: 24rpx;box-sizing: border-box;position: relative;" :class="xiang.collect==1?'active':'a'">
						<image
							v-if="xiang.collect === 2"
							src="@/static/index/icon_collect.png"
							style="width: 48rpx;height: 48rpx;margin-right: 6rpx;"
							></image>
							<image
							v-else-if="xiang.collect === 1"
							src="@/static/index/icon_collect1.png"
							style="width: 48rpx;height: 48rpx;margin-right: 6rpx;"
							></image>
						<iconCollect :collect_num="xiang.collect" v-if="false"></iconCollect>
						({{xiang.collect_num || 0}})
					</view>
				</view>
			</view>
			<view class="bg-white rounded-20 flex justify-between" v-if="false">
				<view style="line-height: 60rpx;padding-left: 40rpx;position: relative;">
					<image src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20220329/%E5%9B%BE%E5%B1%82%20540%402x.png" style="width: 30rpx;height: 30rpx;position: absolute;top: 15rpx;left: 0;" mode=""></image>
					<text style="color: #333333;font-size: 26rpx;">
						<text v-if="is_vip==1">{{xiang.mobile || '待完善'}}</text>
						<text v-if="is_vip!=1">{{xiang.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')  || '待完善'}}</text>
					</text>
				</view>
			</view>
			<view  style="margin-top: 26rpx;box-sizing: border-box;padding: 30rpx;background-color: #FFFFFF;border-radius: 16rpx;">
				<view style="line-height: 60rpx;position: relative;font-weight: 600;font-size: 30rpx;color: #000000;">
					<text class="comment_title">评论</text>

					<image src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230411/2176b3fec852179c4610f402fdac0589.png"
						style="width: 100rpx;height: 12rpx;position: absolute;left: -10rpx;bottom: 6rpx;" mode="" v-if="false">
					</image>
				</view>
				<view class="pinglun">
					<view style="width: 100%;margin: 20rpx auto;padding-bottom: 20rpx;" v-for="(item,index) in list" :key='index'>
						<view style="overflow: hidden;">
							<view style="width: 74rpx;height: 74rpx;float: left;margin-right: 20rpx;position: relative;">
								<image :src="item.client.avatar"
									style="width: 74rpx;height: 74rpx;display: block;border-radius:50%;overflow: hidden;"
									mode=""></image>

							</view>
							<view style="width: 85%;float: left;">
								<view style="line-height: 40rpx;width: 100%;height: 40rpx;padding-right: 200rpx;box-sizing: border-box;position: relative;">
									<text style="color: #000000;font-size: 30rpx;display: inline-block;max-width: 350rpx;" class="yihang">
										<text v-if="item.client.remark_name!=''">{{item.client.remark_name || ''}}</text>
										<text v-if="item.client.remark_name!=''" style="margin-left: 10rpx;font-size: 26rpx;">{{item.client.name || ''}}</text>
										<text v-if="item.client.remark_name==''">{{item.client.name || ''}}</text>
									</text>
									<text v-if="item.is_check==1" @click="del_one(item.id,index)" style="color: red;font-size: 24rpx;position: absolute;top: 50%;right: 70rpx;transform: translateY(-50%);">删除</text>
									<text @click="erji(item.id)" style="color: #1fb0ac;font-size: 24rpx;position: absolute;top: 50%;right: 0rpx;transform: translateY(-50%);">回复</text>

								</view>
								<view style="line-height: 40rpx;width: 100%;height: 40rpx;">
									<text style="color: #999999;font-size: 24rpx;">
										{{item.client.company || ''}}
									</text>
								</view>

								<view style="margin-top: 20rpx;color: #333333;font-size: 28rpx;line-height: 40rpx;">
									{{item.comment}}
								</view>
								<view style="margin-top: 20rpx;color:#999999;font-size: 26rpx;line-height: 40rpx;">
									{{item.create_time}}
								</view>
								<view v-if="item.child.length>0" style="margin: 10rpx auto;box-sizing: border-box;padding: 20rpx;border-radius: 10rpx;background-color:#F7F7F7 ;font-size: 26rpx;line-height: 40rpx;width: 100%;">
									<view v-for="(a,b) in item.child" :key='b' style="width: 100%;box-sizing: border-box;padding-right: 100rpx;position: relative;">
										<text style="color: #336699;">{{a.client.remark_name || a.client.name}}：</text>
										<text style="color: #333333;">{{a.comment}}</text>
										<text v-if="a.is_check==1" @click="del_two(a.id,index,b)" style="color: red;font-size: 24rpx;position: absolute;top: 50%;right: 0;transform: translateY(-50%);">删除</text>
									</view>

								</view>
							</view>
						</view>
					</view>
				</view>

				<!-- <view v-if="enmpy && list.length!=0"
					style="font-size: 28rpx;color: #C0C0C0;text-align: center;line-height: 60rpx;">
					已经到底了！
				</view>
				<view v-if="kk" style="text-align:center;">
					<image src="https://qiniuoss.yjqwl.cn/uploads/20211111/FljQNmzWmi-mO8CGX0Zy28Cc-QdS.png"
						style="width: 490rpx" mode="widthFix"></image>
				</view> -->
				<view v-if="kk" style="text-align: center;">
					<image
						src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20220329/e86889a9b8fd67d8950e4775d67316c.png"
						style="width: 400rpx;" mode="widthFix"></image>
				</view>
				<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="暂无数据"
					v-if="list.length==0"></u-divider>
				<u-divider color='#717171' bg-color='#f0f2f8' height='80' border-color='#717171' text="没有更多了"
					v-if="list.length>0 && enmpy"></u-divider>
			</view>
		</view>
		<view style="position: fixed;left: 0;bottom: 0;width: 100%;">
			<view style="width:100%;height: 140rpx;line-height: 100rpx;background-color: #FFFFFF;overflow: hidden;box-sizing: border-box;padding: 30rpx;">
				<view style="width: 55%;float: left;position: relative;">
					<input type="text" v-model="content" placeholder="我要评论..."
						style="width: 100%;height: 60rpx;line-height: 60rpx;background-color: #F6F6F6;box-sizing: border-box;font-size: 26rpx;color: #999999;border-radius: 30rpx;padding: 0 30rpx;" />
				</view>
				<view class="" style="float: left;width: 20%;line-height: 60rpx;margin-left: 2%;">
					<button :disabled="dianji" @click="ping(0,content)"
						style="font-size: 24rpx;color: #FFFFFF;background-color: #1fb0ac;display: inline-block;border-radius: 30rpx;width: 100%;text-align: center;">评论</button>
				</view>
				<view style="width: 20%;float: right;">
					<image @click="zhu"
						src="https://frozen-info.oss-cn-shanghai.aliyuncs.com/uploads/miniapp/xq/zhuye.png"
						style="width:50rpx ;height: 50rpx;float: left;margin: 2rpx 0;" mode=""></image>
					<button type="default" style="width:50rpx ;height: 50rpx;float: right;margin: 5rpx 0rpx;display: inline-block;position: relative;background: none;border: none;" open-type='share'>
						<image src="https://static-1310167831.cos.ap-nanjing.myqcloud.com/uploads/20230411/4fcdeae6e9ccf0f99aa625071b4bbfc8.png" style="width:50rpx;height: 50rpx;position: absolute;top: 0;left: 0;" mode=""></image>
					</button>
					<!-- <image @click="sharePoster"
						src="https://frozen-info.oss-cn-shanghai.aliyuncs.com/uploads/miniapp/xq/fen.png"
						style="width:50rpx ;height: 50rpx;float: right;margin: 5rpx 0 5rpx 10rpx;" mode=""></image> -->

				</view>
			</view>
		</view>
		<uni-popup id="popup" ref="popup1" :type="type" :animation="true">
			<view class="" style="background-color: #FFFFFF;padding:20upx 30upx 0;border-radius: 20upx;width: 600rpx;">
				<textarea   v-model="nei" placeholder="请输入您的评论" style="padding:20rpx;font-size: 24rpx;line-height: 40rpx;height: 200rpx;" />
				<view class="footer">
					<button @click="guanbi" style="flex: 1;background-color: #f3f3f3;color: #333333;margin-right: 20rpx;font-weight: 600;"
					 type="default">取消</button>
					<button @click="huifu" lang="zh_CN" style="flex: 1;background-color: #1fb0ac;color: #FFFFFF;" open-type="getUserInfo">回复</button>
					<!-- <button @click="submitLink" type="default" class="submit">确认提交</button> -->
				</view>
			</view>
		</uni-popup>

		<uni-popup id="popup" ref="popup2" :type="type_status" :animation="true">
			<view class="" style="background-color: #FFFFFF;padding:20upx 30upx 0;border-radius: 20upx;width: 500rpx;">
				<view
					style="text-align: center;height: 100upx;line-height: 100upx;color: #333333;font-weight: 600;font-size: 32rpx;">
					提示
				</view>
				<view class="popup-content" style="text-align: center;font-size: 28upx;">请授权您的手机号</view>
				<view class="footer">
					<button @click="quxiao2"
						style="flex: 1;background-color: #f3f3f3;color: #333333;margin-right: 20rpx;font-weight: 600;"
						type="default">取消</button>
					<button @getphonenumber="login2" style="flex: 1;background-color: #000000;color: #FFFFFF;"
						open-type="getPhoneNumber">确定</button>

				</view>
			</view>
		</uni-popup>
		<uni-popup id="popup" ref="popup" :type="type_status" :animation="true">
			<view class="" style="background-color: #FFFFFF;padding:20upx 30upx 0;border-radius: 20upx;width: 500rpx;">
				<view
					style="text-align: center;height: 100upx;line-height: 100upx;color: #333333;font-weight: 600;font-size: 32rpx;">
					提示
				</view>
				<view class="popup-content" style="text-align: center;font-size: 28upx;">请授权您的用户信息</view>
				<view class="footer">
					<button @click="quxiao"
						style="flex: 1;background-color: #f3f3f3;color: #333333;margin-right: 20rpx;font-weight: 600;"
						type="default">取消</button>
					<button @click="login" lang="zh_CN" style="flex: 1;background-color: #000000;color: #FFFFFF;"
						open-type="getUserInfo">确定</button>

				</view>
			</view>
		</uni-popup>
		<noLoginToast ref="noLoginToast"/>
    <callPhone ref="callPhone" />
    <model ref="model" />
	</view>
</template>

<script>
import { hideMobile } from '@/common/index.js'
import isAuditIos from '@/common/isAuditIos.js'
	import {
		genTestUserSig
	} from '@/im/debug/GenerateTestUserSig.js';
	const app = getApp();
	import TIM from 'tim-wx-sdk/tim-wx-friendship.js';
	import COS from 'cos-wx-sdk-v5';
	export default {
		mixins: [isAuditIos],
		data() {
			return {
				id: '',
				xiang: {
					like: 2,
					collect: 2
				},
				page: 1,
				kk: false,
				enmpy: false,
				list: [],
				content:'',
				type:'center',
				type_status:'center',
				status:'',
				nei:'',
				is_vip:2,
				userinfo:{},
				degree:'',
				dianji:false,
				isLogin: 'login',
			}
		},
		onLoad(e) {
			this.id = e.id
			this.tzxq()
			this.hqpl()
			this.denglu_im()
		},
		onShow() {
			this.user_info()
		},
		onReachBottom() {
			if (this.enmpy) {
				return
			} else {
				this.hqpl()
			}
		},
		onShareAppMessage(e) {
						// let title = '恭喜dog.东西获得成功'
						let that=this
						return {
							title: that.xiang.main_content,
							path:'/fenbao/pages/wenzhang/wzxq?id='+that.id,
							success(){

							}
						}
					},
		onShareTimeline(e) {
			let that=this
			return {
				title: that.xiang.main_content,
				path:'/fenbao/pages/wenzhang/wzxq?id='+that.id,
				success(){

				}
			}
		},
		methods: {
			hideMobile,
			async del_one(id,index){
				let that=this
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
				uni.showModal({
					title: '提示',
					content: '确定删除此条评论？',
					success (res1) {
						if (res1.confirm) {
							that.post('api/voice/delete_comment',{comment_id:id},true).then(res=>{
								if(res.code==1){
									uni.showToast({
										title: res.msg,
										icon: "none",
										duration: 1000
									})
									that.list.splice(index,1)
									that.xiang.comment_num-=1
									that.$forceUpdate()
								}else{
									uni.showToast({
										title: res.msg,
										icon: "none",
										duration: 1000
									})
								}
							})
						} else if (res1.cancel) {

						}
					}
				});
			},
			async del_two(id,index,b){
				let that=this
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
				uni.showModal({
					title: '提示',
					content: '确定删除此条评论？',
					success (res1) {
						if (res1.confirm) {
							that.post('api/voice/delete_comment',{comment_id:id},true).then(res=>{
								if(res.code==1){
									uni.showToast({
										title: res.msg,
										icon: "none",
										duration: 1000
									})
									that.list[index].child.splice(b,1)
									that.xiang.comment_num-=1
									that.$forceUpdate()
								}else{
									uni.showToast({
										title: res.msg,
										icon: "none",
										duration: 1000
									})
								}
							})
						} else if (res1.cancel) {

						}
					}
				});
			},

			fangda(type){
				 uni.previewImage({
				        urls: this.xiang.main_images,
				        current:type
				 });
			},
			async cope_phone(){
				let that=this
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
				if(this.xiang.mobile){
					if(this.is_vip==1){
						uni.setClipboardData({
							data: String(that.userinfo.mobile),
							success () {
								uni.showToast({
									title: '复制成功',
									icon: "none",
									duration: 1000
								})
							}
						});
					}else if(this.is_vip==0){
						if (this.iosUpAppStore) {
							uni.showModal({
								title: '提示',
								content: '只有会员才可以拨打电话,请前去开通会员！',
								success: function (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						} else {
							uni.setClipboardData({
								data: String(that.userinfo.mobile),
								success () {
									uni.showToast({
										title: '复制成功',
										icon: "none",
										duration: 1000
									})
								}
							});
						}
					}else if(this.is_vip==2){
						if (this.iosUpAppStore) {
							uni.showModal({
								title: '提示',
								content: '只有会员才可以拨打电话,请前去开通会员！',
								success: function (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						} else {
							uni.setClipboardData({
								data: String(that.userinfo.mobile),
								success () {
									uni.showToast({
										title: '复制成功',
										icon: "none",
										duration: 1000
									})
								}
							});
						}
					}
				}else{

				}

			},
			// 拨打电话
			async phone(){
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
				if(this.xiang.mobile){
					if(this.is_vip==1){
						this.callPhone(this.xiang.mobile)
						// uni.makePhoneCall({
						// 	phoneNumber: this.xiang.mobile //仅为示例
						// });
					}else if(this.is_vip==0){
						if (this.iosUpAppStore) {
							uni.showModal({
								title: '提示',
								content: '只有会员才可以拨打电话,请前去开通会员！',
								success: function (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						} else {
							this.callPhone(this.xiang.mobile)
						}
					}else if(this.is_vip==2){
						if (this.iosUpAppStore) {
							uni.showModal({
								title: '提示',
								content: '只有会员才可以拨打电话,请前去开通会员！',
								success: function (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						} else {
							this.callPhone(this.xiang.mobile)
						}
					}
				}else{

				}
			},
			callPhone(phoneNumber) {
				console.log(phoneNumber)
				this.$refs.callPhone.open(phoneNumber)
			},
			async yonghu_xx(id,type,f_id,status,name){
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
				if(type==1){
					if(status==1){
						uni.navigateTo({
							url:'qyxq?id='+f_id+'&name='+name
						})
					}else{
						uni.navigateTo({
							url:'../../../subpages/pages/wuliuqiye/wl_qyxq?id='+f_id+'&name='+name
						})
					}
				}else{
					uni.navigateTo({
						url:'yhxx?id='+id
					})
				}
			},
			user_info() {
				this.post('api/client/info', '', true).then(res => {
					console.log(res)
					if (res.code == 1) {
						this.is_vip = res.data.is_vip
						this.userinfo=res.data
						this.degree=res.data.degree
					}
				})
			},
			denglu_im() {
				let that=this
				const userID = uni.getStorageSync('mobile2').toString();
				const userSig = genTestUserSig(userID).userSig;
				app.globalData.userInfo = {
					userSig,
					userID
				};

				uni.setStorageSync('userInfo', app.globalData.userInfo);

				// 登录腾讯im
				uni.$TUIKit
					.login({
						userID: userID,
						userSig: userSig
					})
					.then(res => {
						this.$store.commit('setToken', app.globalData.userInfo);

						uni.$TUIKit.on(uni.$TUIKitEvent.CONVERSATION_LIST_UPDATED, this.onConversationListUpdated);
						setTimeout(function(){
							that.getConversationList();
						},500)
					})
					.catch(() => {});
			},
			// 私信
			async sixin(){
				let that=this
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
				that.post('api/im/im/friend_msg',{client_id:that.xiang.user_id},true).then(res=>{
					if(res.code==1){
						uni.setStorageSync('friend_id',res.data.friend_id)
						uni.setStorageSync('friend_name',that.xiang.name)
						let aid='C2C'+that.xiang.mobile2
						uni.navigateTo({
								url: `/im/chat/chat?conversationID=${aid}`,
									// url: `/im/login/login`,
						})
					}else if(res.code==211){
						if (this.iosUpAppStore) {
							uni.showModal({
								title: '提示',
								content: res.msg,
								success (res1) {
									if (res1.confirm) {
										uni.navigateTo({
											url:'../../../subpages/pages/vip'
										})
									} else if (res1.cancel) {

									}
								}
							});
						} else {
							uni.setStorageSync('friend_id',res.data.friend_id)
							uni.setStorageSync('friend_name',that.xiang.name)
							let aid='C2C'+that.xiang.mobile2
							uni.navigateTo({
									url: `/im/chat/chat?conversationID=${aid}`,
										// url: `/im/login/login`,
							})
						}

					}
					else{
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			},
			zhu(){
				uni.switchTab({
					url:'/pages/index/index'
				})
			},
			tzxq() {
				this.post('api/voice/info', {
					id: this.id
				}, true).then(res => {
					console.log(res)
					if (res.code == 1) {
						this.xiang = res.data
						console.log('%c [ this.xiang ]-743', 'font-size:13px; background:pink; color:#bf2c9f;', this.xiang)
					}
				})
			},
			// 获取评论
			hqpl(click) {
				this.post('api/voice/comment', {
					voice_id: this.id,
					page: this.page,
					limit:10
				}, true).then(res => {
					console.log(res, 123456)
					if (res.code == 1) {
						if (this.page == 1) {
							if (res.data.data == null || res.data.data.length == 0) {
								this.kk = true
								this.enmpy = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy = true
							}
						} else {
							if (res.data.data == null || res.data.data.length == 0) {
								this.enmpy = true
								return
							} else if (res.data.data.length < 10) {
								this.enmpy = true
							}
						}

						this.page++
						if(click==1){
							this.list=[]
						}
						this.list.push(...res.data.data)
						console.log(this.list,123456)
					} else {
						this.kk = true
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			},
			// 评论
			async ping(id, rong) {
				console.log('%c [ id ]-800', 'font-size:13px; background:pink; color:#bf2c9f;', id)
				let that = this
				that.dianji=true
				let isLogin = await this.$refs.noLoginToast.open()
				console.log('%c [ isLogin ]-804', 'font-size:13px; background:pink; color:#bf2c9f;', isLogin)
				if (!isLogin) {
					that.dianji=false
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					that.dianji=false
					return
				}
				if(this.degree<100){
					that.dianji=false
					this.$refs.model.open()
					return
				}

				this.post('api/voice/publish_comment', {
					voice_id: this.id,
					pid: id,
					comment: rong
				}, true).then(res => {
					console.log(res)
					if (res.code == 1) {
						uni.showToast({
							icon: 'none',
							title: res.msg,
							duration: 1000
						});
						that.dianji=false
						that.xiang.comment_num+=1
						that.$forceUpdate()

						setTimeout(function() {
							that.content = ''
							that.page = 1
							that.kk = false
							that.enmpy = false
							that.hqpl(1)
						}, 1500)

					} else {
						that.dianji=false
						uni.showToast({
							icon: 'none',
							title: res.msg,
							duration: 1500
						});
					}
				})

			},
			async erji(id){
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
				if(this.degree<100){
					this.$refs.model.open()
				}else {
					console.log(111111111)
					this.$refs.popup1.open()
					this.status=id
				}
			},
			guanbi(){
				this.$refs.popup1.close()
			},
			huifu(){
				this.$refs.popup1.close()
				this.ping(this.status,this.nei)
			},
			// 收藏
			async shou() {
				let that = this
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
				this.post('api/voice/collect', {
					voice_id: this.id
				}, true).then(res => {
					console.log(res)
					if (res.code == 1) {
						uni.showToast({
							icon: 'none',
							title: res.msg,
							duration: 1500
						});
						if (res.data) {
							this.xiang.collect = 1
							this.xiang.collect_num += 1
						} else {
							this.xiang.collect = 2
							this.xiang.collect_num -= 1
						}
					}
				})
			},
			// 点赞
			async dian() {
				let that = this
				let isLogin = await this.$refs.noLoginToast.open()
				if (!isLogin) {
					return
				}
				let isHasMobile = await this.$refs.noLoginToast.getPhoneNumber()
				if (!isHasMobile) {
					return
				}
					this.post('api/voice/like', {
						voice_id: this.id
					}, true).then(res => {
						console.log(res)
						if (res.code == 1) {
							uni.showToast({
								icon: 'none',
								title: res.msg,
								duration: 1500
							});
							if (res.data) {
								this.xiang.like = 1
								this.xiang.like_num += 1
							} else {
								this.xiang.like = 2
								this.xiang.like_num -= 1
							}
						}
					})
			},

			quxiao2() {
				this.$refs.popup2.close()
			},
			login2(e) {
				console.log(e)
				let that = this
				this.$refs.popup2.close()
				uni.login({
					provider: 'weixin',
					success: (code) => {
						console.log(code)
						this.post('api/wechat/phone', {
							code: code.code,
							iv: e.detail.iv,
							encryptedData: e.detail.encryptedData
						}, true).then(res => {
							console.log(res, '123455')
							if (res.code == 1) {
								uni.setStorageSync('mobile', res.data.phoneNumber)
								uni.setStorageSync('mobile2',res.data.mobile2)
								that.denglu_im()
							}

						})

					}
				})
			}


		}
	}
</script>

<style lang="scss">
	.xiao {
		color: #18A9A5;
		font-size: 20rpx;
		padding: 0rpx 10rpx;
		background: #81D8D0;
		border-radius: 14rpx;
		display: inline-block;
		height: 30rpx;
		line-height: 30rpx;
		margin-right: 10rpx;
		margin-bottom: 10rpx;
		float: left;
	}
	.pinglun>view{
		border-bottom: 1px solid #eeeeee;
	}
	.pinglun>view:last-child{
		border: none;
	}
	.footer {
		display: flex;
		justify-content: space-between;
		border-top: 1px solid #f4f4f4;
		margin-top: 30rpx;
		padding-bottom: 20rpx;

		button {
			margin: 0 auto;
			width: 100%;
			background-color: #19BE6B;
			// width: 200upx;
			border-radius: 10upx;
			font-size: $uni-font-size-sm;
			// padding: 22upx 34upx;
			height: 80upx;
			font-size: 30rpx;
			line-height: 80upx !important;
			// line-height: 1;
			color: #FFFFFF;
		}

		button:after {
			border: 0;
		}
	}
	page {
		background-color: #F8F8F8 !important;
		padding-bottom: 150rpx;
		font-family: Demibold;
	}
	.active{
		color: #1fb0ac;
	}
	.a{
		color: #999999;
	}
	.tu>view {
		margin: 10rpx 0;
	}

	.tu>view:nth-child(3n+2) {
		margin: 10rpx 30rpx;
	}
	.footer {
		display: flex;
		justify-content: space-between;
		border-top: 1px solid #f4f4f4;
		margin-top: 30rpx;
		padding-bottom: 20rpx;

		button {
			margin: 0 auto;
			width: 100%;
			background-color: #19BE6B;
			// width: 200upx;
			border-radius: 10upx;
			font-size: $uni-font-size-sm;
			// padding: 22upx 34upx;
			height: 80upx;
			font-size: 30rpx;
			line-height: 80upx !important;
			// line-height: 1;
			color: #FFFFFF;
		}

		button:after {
			border: 0;
		}
	}
	button:after {
		border: 0;
	}
	.comment_title {
		border-bottom: 2px solid #19BE6B;
	}
</style>
